import request from '@/utils/request'

// 获取公司树状部门信息
export function getDepartments() {
  return request({
    url: '/company/department'
  })
}

// 获取部门删除接口
export function delDepartment(id) {
  return request({
    // 接口请求方法有四种，分别是增删改查，只不过以前只用了两种（get\post）
    method: 'delete',
    url: `/company/department/${id}`
  })
}

// 新增部门
export function addDepartment(data) {
  return request({
    url: '/company/department',
    method: 'post',
    data
  })
}

// 获取部门详细信息
export function getDepartmentDetail(id) {
  return request({
    url: `/company/department/${id}`
  })
}

// 根据id编辑部门信息
export function editDepartment(data) {
  return request({
    method: 'put',
    url: `/company/department/${data.id}`,
    data
  })
}
